<?
/**
* <b>xmlRenderer</b>
*
* XML-renderer
*
* @package gravy.classes.renderers
* @class xmlRenderer extends renderer
*/
class xmlRenderer extends renderer{	
	public function __construct($gravy){
		// call the construct
		parent::__construct($gravy);
	}
	
	/**
	* <b>setHeadersForOutput</b>
	* Implementation of abstract function
	* Sets up the header information for HTML
	*
	* @fn setHeadersForOutput
	* @param $statusCode [def = null]
	* @return void
	*/
	public function setHeadersForOutput($statusCode=null){
		if(!$this->headerSent){			
			header("Content-Type: text/xml; charset=utf-8");
			header("Cache-Control:no-cache,must-revalidate");
			header("Pragma:");			
			if($statusCode!=null){
				header(' ',true,$statusCode);
			}
			$this->headerSent=true;
			if($this->gravy->data["raw"]===TRUE){
				print($this->gravy->data["data"]);
				exit();
			}
		}
	}

	/**
	* <b>render</b>
	*
	* Gets XML data from gravy member and prints the string (converted from array to xml)
	*
	* @fn render
	* @return void
	*/	
	public function render(){
		// start the render process
		$ar=$this->gravy->getXmlData();
		$converter=new arrayXML();
		$str=$converter->array2xml($ar);
		print($str);
	}
	
	/**
	* <b>renderError</b>
	*
	* Set render error ...
	*
	* @fn renderError
	* @param $statusCode
	* @return void
	*/	
	public function renderError($statusCode){
	}
};
?>
